package com.cp_smss.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cp_smss.dao.BusinessDao;
import com.cp_smss.model.Page;
import com.cp_smss.model.Project;
import com.cp_smss.service.BusinessService;

@Service("businessService")
public class BusinessServiceImpl implements BusinessService{

	@Resource(name="businessDao")
	private BusinessDao businessDao;
	
	@Override
	public List<Project> listProjects(Page page) {
		return businessDao.listProjects(page);
	}

	@Override
	public int addProject(Project project) {
		String projectName = project.getProjectName();
		if(businessDao.validateProjectName(projectName)<=0){
			return businessDao.addProject(project);
		}
		return 0;
	}

	@Override
	public void deleteProject(int[] pids) {
		businessDao.deleteProject(pids);
		
	}

	public Project getProjectByCondition(Project project){
		return businessDao.getProjectByCondition(project);
	}
	
	@Override
	public void editProject(Project project) {
		businessDao.editProject(project);
	}
	
}
